#include <stdio.h>
#include <stdlib.h>
// 声明一个单链表结构体
typedef struct Node{
    int data;
    struct Node* next;
}Node,*List;
//尾插
int addtail(List L,int data){
    //新建节点
    Node* node = (Node*)malloc(sizeof(Node));
    node->data = data;
    node->next = NULL;
    L->next = node;
}
int main(){
    // 创建头结点
    List L = (Node*)malloc(sizeof(Node));  //申请内存空间

    L->next=NULL;

    //尾插
   // addtail(L,2);
    Node* node = (Node*)malloc(sizeof(Node));
    node->data = 2;
    node->next = NULL;
    L->next = node;

    //输出
    while (L->next != NULL)
    {
        printf("-%d-",L->data);
        L = L->next;
    }
    

}